﻿#ifndef SIGNUP_H
#define SIGNUP_H

#include <QWidget>
#include <QTcpSocket>
#include <QMouseEvent>

namespace Ui {
class SignUp;
}

class SignUp : public QWidget
{
    Q_OBJECT

public:
    explicit SignUp(QWidget *parent = nullptr);
    ~SignUp();

    // 发送到服务器
    void WriteToServer(const QJsonObject &obj);

    // 处理json逻辑
    void process(const QByteArray &data);

    // 设置头像
    void SetPhoto(const QPixmap &photo);

protected:
    void mousePressEvent(QMouseEvent *e);

signals:
    void GoBack();

public slots:
    void GetSocket(QTcpSocket *socket);

private slots:
    void on_pushButton_sure_clicked();

    void on_pushButton_cancle_clicked();

//    void ReadData();

private:
    Ui::SignUp *ui;
    QTcpSocket *socket;
    QByteArray buffer; // 自定义缓冲区
};

#endif // SIGNUP_H
